<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use EasyWeChat\Foundation\Application;
//群发消息
class BroadCastController extends Controller
{
    public $broadcast;
    
    public function __construct(Application $app) {
        $this->broadcast = $app->broadcast;
    }
    
    //群发给指定用户，如果指定openid的话，那么最少指定两个openid
    public function broadcast(){
        //$this->broadcast->sendText('欢迎关注EAI交易圈', ['oQOhE1S7t84YBEDR8Ssw1wgFveWs', 'oQOhE1ao6mO1dcx4pQIGF-w7TB3A']);
        //$this->broadcast->send('text', '欢迎关注EAI交易圈', ['oQOhE1S7t84YBEDR8Ssw1wgFveWs', 'oQOhE1YNtbYnMUXNuxtnsRHkFcZg']);
        $this->broadcast->send('news','U-IurB2c4Rn8XIdJu22FyI1FsYN7agAp0UZfgRg4dwk',['oQOhE1ao6mO1dcx4pQIGF-w7TB3A', 'oQOhE1YNtbYnMUXNuxtnsRHkFcZg']);
        return 'OK';        
    }
}
